﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EIIS.FrameWork.Repository;
using EIIS.Infrastructure.Model.Business;

namespace EIIS.Infrastructure.Repositories.Business
{
    public interface IPackageRepository : IRepository<Package>
    {
        /// <summary>
        /// 根据状态获取包的结果集
        /// </summary>
        /// <param name="total">总数</param>
        /// <param name="ZhuangT">状态值</param>
        /// <param name="page">当前页</param>
        /// <param name="rows">行数</param>
        /// <param name="order">排序字段</param>
        /// <param name="sort">排序规则：asc,desc</param>
        /// <returns></returns>
        IQueryable<Package> LoadAllByPage(out long total, int ZhuangT, int page, int rows, string order, string sort);

        /// <summary>
        /// 根据条码号获取实体
        /// </summary>
        /// <param name="strTiaoMH">条码号</param>
        /// <returns></returns>
        Package GetByTiaoMH(string strTiaoMH);

        /// <summary>
        /// 根据状态获取所有包的记录
        /// </summary>
        /// <param name="ZhuangT">状态值</param>
        /// <returns></returns>
        IQueryable<Package> GetAllByZhuangT(int ZhuangT);

        /// <summary>
        /// 确认灭菌
        /// </summary>
        /// <param name="MieJGH">灭菌锅号</param>
        /// <param name="MieJGC">灭菌锅次</param>
        /// <param name="YouXQ">有效期</param>
        /// <param name="ShiXSJ">失效时间</param>
        /// <param name="MieJR">灭菌人</param>
        bool SaveMieJ(string MieJGH, string MieJGC, string YouXQ, string ShiXSJ, string MieJR);

        /// <summary>
        /// 确认发放
        /// </summary>
        /// <param name="LingYKS">领用科室</param>
        /// <param name="LingYR">领用人</param>
        /// <param name="ShiYR">使用人</param>
        /// <param name="FaFR">发放人</param>
        bool SaveFangF(string LingYKS, string LingYR, string ShiYR, string FaFR);

        /// <summary>
        /// 确认回收
        /// </summary>
        /// <param name="HuiSR">回收人</param>
        bool SaveHuiS(string HuiSR);

        /// <summary>
        /// 根据状态计算有多少条相应的记录
        /// </summary>
        /// <param name="ZhuangT">状态值</param>
        /// <returns></returns>
        long CountByZhuangT(int ZhuangT);

        /// <summary>
        /// 获取包、数据字典相关的视图的记录
        /// </summary>
        /// <returns></returns>
        IList<V_Package> GetAllPackageView();

        /// <summary>
        /// 获取表Package中获取库存记录
        /// </summary>
        /// <param name="strBaoBM">包编码</param>
        /// <returns></returns>
        IList<Package> GetInventory(string strBaoBM);
        

        /// <summary>
        /// 获取未归还记录
        /// </summary>
        /// <param name="strBaoBM">包编码</param>
        /// <returns></returns>
        IList<Package> GetNoReurns(string strBaoBM);

        /// <summary>
        /// 根据时间段获取记录
        /// </summary>
        /// <param name="begin">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="strWhere">其他的条件</param>
        /// <returns></returns>
        IList<V_Package> GetRecordsByPeriodTime(string begin, string end, string strWhere);

        /// <summary>
        /// 获取当天的记录报表
        /// </summary>
        /// <returns></returns>
        IList<Package> GetDayRecords();

        /// <summary>
        /// 从视图V_Package中获取库存记录报表，这里存在没进入包装流程的包
        /// </summary>
        /// <returns></returns>
        IList GetInventoryReport();
    }
}
